f(m,n){return n==0?m:f(m*n,n-1);}
main(n,k)
{
	for(gets(&n);~scanf("%d%d",&n,&k);)
		printf("%d\n",f(1,n)/(f(1,k)*f(1,n-k)));
}
